home *** CD-ROM | disk | FTP | other *** search
- class Arr extends Array
- {
- var iap = 0;
- function Arr()
- {
- super();
- this.splice.apply(this,[0,0].concat(arguments));
- }
- function randInd()
- {
- return Math.floor(Math.random() * this.length);
- }
- function rand()
- {
- return this[Math.floor(Math.random() * this.length)];
- }
- function mean()
- {
- var _loc3_ = 0;
- var _loc4_ = 0;
- var _loc2_ = 0;
- while(_loc2_ < this.length)
- {
- if(!isNaN(Number(this[_loc2_])))
- {
- _loc3_ = _loc3_ + 1;
- _loc4_ += Number(this[_loc2_]);
- }
- _loc2_ = _loc2_ + 1;
- }
- if(_loc3_ > 0)
- {
- return _loc4_ / _loc3_;
- }
- return 0;
- }
- function copy()
- {
- var _loc2_ = new Arr();
- for(var _loc3_ in this)
- {
- _loc2_[_loc3_] = this[_loc3_];
- }
- return _loc2_;
- }
- function current()
- {
- return this[this.iap];
- }
- function next()
- {
- if(this.iap + 1 < this.length)
- {
- this.iap = this.iap + 1;
- return this[this.iap];
- }
- return false;
- }
- function prev()
- {
- if(this.iap > 0)
- {
- this.iap = this.iap - 1;
- return this[this.iap];
- }
- return false;
- }
- function reset()
- {
- if(this.length > 0)
- {
- this.iap = 0;
- return this[this.iap];
- }
- return false;
- }
- function end()
- {
- if(this.length > 0)
- {
- this.iap = this.length - 1;
- return this[this.iap];
- }
- return false;
- }
- }
-